package cz.uhk.ppro.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import cz.uhk.ppro.form.Login;

public class KontaktniOsobaValidator implements Validator{

	public boolean supports(Class<?> clazz) {
		return Login.class.isAssignableFrom(clazz);
	}

	public void validate(Object target, Errors errors) {
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "jmeno", "jmeno.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "prijmeni", "prijmeni.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "telefon", "telefon.required");		
	}

}
